<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends MX_Controller {
	private $module = 'home';
	function __construct(){
		parent::__construct();
		
		$this->load->model($this->module.'_model','model');
		$this->load->model('contact/contact_model','contactModel');
		$this->load->model('slide/slide_model','slideModel');
		$this->load->model('category/category_model','categoryModel');
		$this->load->model('support/support_model','supportModel');
		$this->load->model('products/products_model','productsModel');
		
		$this->template->write('title','Online 24/24');
		$this->template->write('meta_keywords','');
		$this->template->write('meta_description','');
		$this->template->write('meta_image','');
		$this->template->write('meta_video','');
	}
	
	/*-------------------------------------- FrontEnd --------------------------------------*/
	function index(){
		$products=$this->productsModel->getProNew();
		$data=array(
			'products'=>$products,
			'title'=>'Trang chủ',
			'module' => $this->module,
		);
		$this->load->view('index',$data);
	}
	
	function top(){
		$this->load->view('top');	
	}
	
	function head(){
		$contact=$this->contactModel->getInfo();
		
		$data=array(
			'contact' => $contact,
		);
		
		$this->load->view('header',$data);
	}
	
	function menu(){
		$this->load->model('home_model');
		$menu=$this->home_model->getMenu();
		$category=$this->categoryModel->getCategory();
		$contact=$this->contactModel->getInfo();
		$data=array(
			'menu' => $menu,
			'category' => $category,
			'contact' => $contact,
		);
		$this->load->view('menu',$data);
	}
	
	function slide(){
		$data['slide']=$this->slideModel->getSlide();
		$this->load->view('slide',$data);
	}
	
	function cart(){
		$data['result']=$this->productsModel->getProSell();
		$this->load->view('cart',$data);
	}
	
	function proNew(){
		$data['proNew']=$this->productsModel->getProNew();
		$this->load->view('pronew',$data);
	}
	
	function proSeller(){
		$data['result']=$this->productsModel->getProSell();
		$this->load->view('seller',$data);
	}
	
	function category(){
		$data['category']=$this->categoryModel->getCategory();
		$this->load->view('category',$data);
	}
	
	function support(){
		$data['support']=$this->supportModel->getSuppot();
		$this->load->view('support',$data);
	}
	
	function footer(){		
		$this->load->view('footer');
	}	
}